<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>添加节点</title>
    <link rel="stylesheet" href="__LAY__/css/layui.css" media="all">
    <link rel="stylesheet" href="__CSS__/main.css" media="all">
</head>
<body>
<div class="right_body">
    <div class="body_content">
        <fieldset class="layui-elem-field">
            <legend>节点添加</legend>
            <div class="layui-field-box">
                <form class="layui-form layui-form-pane" id="commentForm" method="post" action="{:url('node/addnode')}">
                    <input type="text" name="pid" value="{$pid}" hidden>
                    <div class="layui-form-item ">
                        <label class="layui-form-label">菜单名称</label>
                        <div class="layui-input-inline">
                            <input type="text" name="node_name" required  lay-verType="tips"	 lay-verify="required" placeholder="请输入菜单名称" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item ">
                        <label class="layui-form-label">控制器名称</label>
                        <div class="layui-input-inline">
                            <input type="text" name="controller_name" required  lay-verType="tips"	 lay-verify="required" placeholder="请输入控制器名称" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item ">
                        <label class="layui-form-label">方法名称</label>
                        <div class="layui-input-inline">
                            <input type="text" name="action_name" required  lay-verType="tips"	 lay-verify="required" placeholder="请输入方法名称" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item ">
                        <label class="layui-form-label">菜单小图标</label>
                        <div class="layui-input-inline">
                            <input type="text" name="style" required  lay-verType="tips"	 lay-verify="required" placeholder="请输入菜单小图标" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item ">
                        <label class="layui-form-label">排序</label>
                        <div class="layui-input-inline">
                            <input type="text" name="sort" placeholder="请输入序号" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item radio-input" pane>
                        <label class="layui-form-label">是否是菜单</label>
                        <div class="layui-input-block" >
                            <input type="radio" name="is_menu" value="1" title="是" checked>
                            <input type="radio" name="is_menu" value="0" title="否" >
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button class="layui-btn layui-btn-radius layui-btn-normal" lay-submit lay-filter="formDemo">立即提交</button>
                        </div>
                    </div>
                </form>
            </div>
        </fieldset>
    </div>
</div>
</body>
<script type="text/javascript" src="__JS__/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="__LAY__/layui.js"></script>
<script type="text/javascript" src="__JS__/index.js"></script>
<script type="text/javascript" src="__JS__/jquery.form.js"></script>
<script src="https://cdn.bootcss.com/limonte-sweetalert2/7.21.1/sweetalert2.all.js"></script>
<script type="text/javascript">
    var index = '';
    function showStart(){
        index = layer.load(0, {shade: false});
        return true;
    }
    function showSuccess(res){
        layer.ready(function(){
            layer.close(index);
            if(1 == res.code){
                swal({
                    title: res.msg,
                    timer: 2000,
                    type: 'success'
                }).then(
                    function (dismiss) {
                        window.parent.location.href = res.data;
                        parent.layer.close(index);
                    }
                );

            }else if(111 == res.code){
                window.location.reload();
            }else{
                sweetAlert(
                    '哎呦……',
                    res.msg,
                    'error'
                );
            }
        });
    }
    $(document).ready(function(){
        var options = {
            beforeSubmit:showStart,
            success:showSuccess
        };
        $('#commentForm').submit(function(){
            //下拉框监控事件
            $(this).ajaxSubmit(options);
            return false;
        });
    });
</script>

</html>